<template>
  <div v-if="student">
    <StudentIndex />
  </div>
  <div v-else-if="admin">
    <AdminIndex />
  </div>

  <div v-else-if="expert">
    <ExpertIndex />
  </div>
</template>

<script>
import StudentIndex from "./studentIndex.vue";
import { getUserProfile } from "@/api/system/user";
import AdminIndex from "./AdminIndex.vue";
import ExpertIndex from "./ExpertIndex.vue";
import "core-js/stable";

export default {
  components: {
    StudentIndex,
    AdminIndex,
    ExpertIndex,
  },

  data() {
    return {
      student: false,
      admin: false,
      expert: false,
    };
  },

  mounted() {
    this.init();
  },

  methods: {
    init() {
      getUserProfile().then((response) => {
        console.log(response.data);
        if (response.data.remark == "管理员") {
          this.admin = true;
        } else if (response.roleGroup == "专家") {
          this.expert = true;
        } else {
          this.student = true;
        }
      });
    },
  },
};
</script>
